﻿<UserControl
    x:Class="Posroid.DietDay"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Posroid"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="600"
    d:DesignWidth="400">
    
    <UserControl.Resources>
        <Style x:Key="CaloriesTextStyle" TargetType="TextBlock" BasedOn="{StaticResource CaptionTextStyle}" >
            <Setter Property="Foreground" Value="Gray" />
        </Style>
    </UserControl.Resources>
    
    <Grid Background="#B3DAD7D7" Margin="15">
        <Grid.RowDefinitions>
            <RowDefinition Height="80" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        
        <StackPanel Orientation="Horizontal" Margin="10,0,0,25">
            <TextBlock Text="{Binding ServedDate, Converter={StaticResource dateConverter}, ConverterParameter=MM/DD}" Style="{StaticResource HeaderTextStyle}" VerticalAlignment="Bottom"/>
            <TextBlock Text="{Binding ServedDate, Converter={StaticResource dateConverter}, ConverterParameter=dayofweek}" Style="{StaticResource SubheaderTextStyle}" VerticalAlignment="Bottom" />
        </StackPanel>
        
        <ItemsControl Grid.Row="1" ItemsSource="{Binding Times}" >
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <Grid Margin="30,20,0,20">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="25" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="{Binding Mealtime}" >
                                <TextBlock.Style>
                                    <Style BasedOn="{StaticResource BaselineTextStyle}" TargetType="TextBlock">
                                        <Setter Property="FontSize" Value="35"/>
                                        <Setter Property="FontWeight" Value="Light"/>
                                    </Style>
                                </TextBlock.Style>
                            </TextBlock>
                        </StackPanel>
                        
                        <ItemsControl ItemsSource="{Binding WhatFoods}" Grid.Row="1" >
                            <ItemsControl.ItemTemplate>
                                <DataTemplate>
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="50" />
                                            <ColumnDefinition Width="*" />
                                        </Grid.ColumnDefinitions>
                                        <TextBlock Text="{Binding Type}" FontSize="70" Foreground="#FFEEEEEE" HorizontalAlignment="Left" VerticalAlignment="Top"/>
                                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="5,60,0,0">
                                            <TextBlock Text="{Binding Kilocalories}" Style="{StaticResource CaloriesTextStyle}" />
                                            <TextBlock Text="kcal" Style="{StaticResource CaloriesTextStyle}" />
                                        </StackPanel>
                                        <ItemsControl ItemsSource="{Binding Foods}" Grid.Column="1" Margin="13" >
                                            <ItemsControl.ItemTemplate>
                                                <DataTemplate>
                                                    <TextBlock Text="{Binding langstr, Converter={StaticResource languageConverter}, ConverterParameter={StaticResource preferedLanguage}}" />
                                                </DataTemplate>
                                            </ItemsControl.ItemTemplate>
                                        </ItemsControl>
                                    </Grid>
                                </DataTemplate>
                            </ItemsControl.ItemTemplate>
                        </ItemsControl>
                    </Grid>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>
    </Grid>
</UserControl>
